package com.example.game_level;

import org.andengine.entity.scene.background.Background;
import org.andengine.entity.scene.menu.MenuScene;
import org.andengine.entity.scene.menu.MenuScene.IOnMenuItemClickListener;
import org.andengine.entity.scene.menu.item.IMenuItem;
import org.andengine.entity.scene.menu.item.TextMenuItem;

public class NextScene extends MenuScene implements IOnMenuItemClickListener {
	StartActivity activity;
	final int menu_start=0;
	
	final int lev2=2;
	final int lev3=3;
	final int lev4=4;
	final int lev5=5;
	
	public NextScene(){
		
	    super(StartActivity.getSharedInstance().mCamera);
	    activity=StartActivity.getSharedInstance();
	    
	    
	    
	    setBackground(new Background(0.09804f, 0.6274f, 0.8784f));
	    
	    switch(activity.level){
	    
	    case 2: IMenuItem lev2Button = new TextMenuItem(lev2, activity.mFont, "Level 2", activity.getVertexBufferObjectManager());
		lev2Button.setPosition(mCamera.getWidth() / 2 - lev2Button.getWidth() / 2, 110);
		addMenuItem(lev2Button);break;
	    
	    case 3: IMenuItem lev3Button = new TextMenuItem(lev3, activity.mFont, "Level 3", activity.getVertexBufferObjectManager());
		lev3Button.setPosition(mCamera.getWidth() / 2 - lev3Button.getWidth() / 2, 210);
		addMenuItem(lev3Button);break;
		
	    case 4: IMenuItem lev4Button = new TextMenuItem(lev4, activity.mFont, "Level 4", activity.getVertexBufferObjectManager());
		lev4Button.setPosition(mCamera.getWidth() / 2 - lev4Button.getWidth() / 2, 410);
		addMenuItem(lev4Button);break;
		
/*	    case 5: IMenuItem lev5Button = new TextMenuItem(lev5, activity.mFont, "Level 5", activity.getVertexBufferObjectManager());
		lev5Button.setPosition(mCamera.getWidth() / 2 - lev5Button.getWidth() / 2, 510);
		addMenuItem(lev5Button);break;
	*/	
	    }
		setOnMenuItemClickListener((IOnMenuItemClickListener) this);
		
		
	}
	@Override
	public boolean onMenuItemClicked(MenuScene arg0, IMenuItem arg1, float arg2, float arg3) {
			    switch (arg1.getID()) {
			        
			        case lev2:
			        	activity.level=2;
			        	activity.setCurrentScene(new GameScene());
			            return true;
			            
			        case lev3:
				        activity.level=3;
			        	activity.setCurrentScene(new GameScene());
			            return true;
			            
			        case lev4:
			        	activity.level=4;
			        	activity.setCurrentScene(new GameScene());
			            return true;
			            
/*			        case lev5:
			        	activity.level=5;
			        	activity.setCurrentScene(new GameScene());
			            return true;
	*/		            
			        default:
			            break;
			    }
			    return false;
			}
}
